Applying Substitutions
Substitutions can be applied
- in Run mode
- in Edit mode
- via command line
- via command line to multiple .csf files
Applying a Substitution in Run Mode
Run mode substitution does not modify the CygNet Studio File (.csf). The substitutions are only applied when the screen is opened in Run mode. Substitution can be used to provide a behavior similar to templating, but is more powerful since it can change many properties at once.
A system default may be set on installation, or it can be overridden on a per-user basis.
To Apply a Substitution in Run Mode
- Create the Substitution file using Notepad or an XML editor.
- On the CygNet Studio Options menu, click Settings.
- Click to enable Run Mode Substitution.
- Click … to browse to the Substitution file and click Open.
- Select the Substitution Set from the drop-down menu.
- Click OK.
Applying a Substitution in Edit Mode
Edit mode substitution provides a method to perform a one-time application of a substitution set to a CSF that is currently open in Edit mode. The CSF file is left in a modified state, and must be saved for the changes to be made permanent. Edit mode substitution can be invoked via the Apply Substitutions dialog box under the Edit menu.
To Apply a Substitution in Edit Mode
- Create the file using Notepad or an XML editor.
- On the Edit menu, click Apply Substitutions.
- Click … to browse to the Substitution file and click Open.
- Select the Substitution Set from the drop-down menu.
- Click OK.
Applying a Substitution via Command Line
Command-line substitution operates similarly to edit-mode substitution, except that it permanently modifies CSF files. Backing up your files before performing a command-line substitution is highly recommended. Command-line substitution is only available from CygNet Studio, not CygNet Vision.
The syntax is as follows:
cstudio /conv subs.xml:"Standard Substitutions" screen.csf
The command-line parameters are described in the following table:
| Parameters | Description | |
|---|---|---|
|
/conv |
Converts the properties of objects in the specified CygNet Studio file to the substitution set(s) defined in the specified XML file. Example
|
|
|
<file name>.xml: |
Specifies the name of the XML file containing the substitution(s). Example
|
|
|
"<Set Label>" |
Specifies the label of the substitution set you wish to use. Must be enclosed in quotes if the set label name contains a space. Example
|
|
|
<Screen Name>.csf |
Specifies the name of the CygNet Studio screen to modify. Example
|
Apply Substitutions via Command Line to Multiple .csf Files
You can also apply substitutions to multiple CSF files in a single directory via a single command. This is useful when setting up a new CygNet site and you want to customize previously used CygNet Studio screens. The command line option will "step through" each .csf file in the current folder and apply the substitution strings in the specified Substitution .xml file and updating the configuration to reflect the new site.
A copy of CSTUDIO.exe must exist in each sub folder.
The syntax is as follows:
for %x in (*.csf) do start /wait cstudio /conv subs.xml:"My Subs" "%x"
To Apply Substitutions to all .csf Files in a Single Directory
Follow the steps below to run the substitutions against a set of CygNet Studio screens:
- Copy the entire directory structure of previously used Studio screens to the appropriate location on the host server where the new site is running (for example, C:\BSS_Screens).
- Place a copy of CStudio.exe in each directory that contains the .csf files you want to modify.
- Create or modify the Substitution .xml file using Notepad or an XML editor to update any keywords in the CygNet Studio screens to reflect properties for the new site.
- Save the Substitution .xml file in the root directory of the locally saved screens.
- Optional. Copy the Substitution .xml file to each directory that contains .csf files you want to modify.
- Open a Command Prompt, navigate to the directory location where the .csf screens are saved, and run the following command at each directory level:
|
for %x in (*.csf) do start /wait cstudio /conv subs.xml:"My Subs" "%x" where Subs.xml is the file name of your Substitution .xml file and "My Subs" is the name of the substitution set label. Note: If you use a single Substitution .xml file at the root of the directory structure you must include the path to the file in the command line each time you change directories, for example, ../subs.xml or ../../subs.xml, etc. |
- Check the timestamp of each screen to see that it has changed, or open the screen in CygNet Studio to see the substituted properties in action.
- Navigate to the next directory and repeat steps 6 and 7. Repeat until all .csf files have been modified.
- Optional. Delete the CStudio.exe and Substitution .xml file (if there) in each directory.


